<?php
/* @var $this SpendController */
/* @var $model Spend */
/* @var $form TbActiveForm */
?>
<?php $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
    'id' => 'spend-form',
    'enableAjaxValidation' => true,
    'type' => 'horizontal',
    'inlineErrors' => true
)); ?>
<div class="widget-box">
    <div class="widget-content nopadding">
        <?php
        echo $form->textFieldRow($model, 'name');
        echo $form->dropDownListRow($model, 'cat_id', CHtml::listData(Danhmuc::model()->findAll('type = 0 and parent_id IS NULL'), 'id', 'name'),
            array(
                'prompt' => 'Chọn chuyên mục',
                'ajax' => array(
                    'type' => 'POST',
                    'url' => Yii::app()->createAbsoluteUrl('spend/DynamicCategories'),
                    'update' => '#Spend_sub_cat_id',
                    'data' => array('cat_id' => 'js:this.value'),
                ),
            )
        );
        echo $form->dropDownListRow($model, 'sub_cat_id', CHtml::listData(Danhmuc::model()->findAll('type = 3'), 'id', 'name'),
            array(
                'prompt' => 'Chọn danh mục phụ',
            )
        );
        echo $form->textFieldRow($model, 'note');
        ?>
        <div class="control-group">
            <?php
            echo $form->labelEx($model, 'time', array('class' => 'control-label'));
            ?>
            <div class="controls">
                <?php  $this->widget('zii.widgets.jui.CJuiDatePicker', array(
                    'name' => 'time',
                    'value' => $time,
                    'options' => array(
                        'showAnim' => 'fold',
                        'constrainInput' => 'true',
                    ),
                    'htmlOptions' => array(
                        'style' => 'height:20px;'
                    ),
                )); ?>
            </div>
        </div>
        <?php
        echo $form->textFieldRow($model, 'reference');
        echo $form->textFieldRow($model, 'value');
        ?>
        <div class="form-actions">
            <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => 'Thêm mới', 'htmlOptions' => array('name' => 'submit'))); ?>
        </div>
    </div>
</div>
<?php $this->endWidget(); ?>
</div>